/** 工单用业务及部门对应关系 */
import request from '@/utils/request'
/** 新增
 * @params {object} data
 */
export function postBusinessDeptRel(data) {
  return request({
    method: 'POST',
    url: '/call-center/api/v1/businessDeptRelation',
    data
  })
}
/** 修改
 * @params {object} data
 */
export function putBusinessDeptRel(data) {
  return request({
    method: 'PUT',
    url: '/call-center/api/v1/businessDeptRelation',
    data
  })
}
/** 查询所有
 */
// export function getBusinessDeptRel(data) {
//   return request({
//     method: 'GET',
//     url: '/call-center/api/v1/businessDeptRelation/',
//     data
//   })
// }
export function getBusinessDeptRel(data) {
  return request({
    method: 'POST',
    url: '/call-center/api/v1/businessDeptRelation/page',
    params: data
  })
}

/**
 * 获取业务类型指定数据
 * @param {int} parentId 业务类型ParentID
 */
export function getBusinessDeptRelByCode(parentRelationCode) {
  return request({
    method: 'GET',
    url: `/call-center/api/v1/businessDeptRelation/getByParentRelationCode/${parentRelationCode}`
  })
}
/** 根据id查询
 * @params {number} id
 */
export function getByIdBusinessDeptRel(id) {
  return request({
    method: 'GET',
    url: `/call-center/api/v1/businessDeptRelation/${id}`
  })
}
/** 删除
 * @params {number} id
 */
export function deleteBusinessDeptRel(id) {
  return request({
    method: 'DELETE',
    url: `/call-center/api/v1/businessDeptRelation/${id}`
  })
}

/** 删除
 * @params {array} ids
 */
export function deleteBatch(ids) {
  return request({
    method: 'DELETE',
    url: `/call-center/api/v1/businessDeptRelation/deleteBatch`,
    data: {
      ids
    }
  })
}

// 查询所有
export function getBusinessDeptRelAll() {
  return request({
    method: 'GET',
    url: '/call-center/api/v1/businessDeptRelation/'
  })
}

/** 其他系统调用 */
export function getBusinessOpenApiDeptRel(parentRelationCode) {
  return request({
    method: 'GET',
    url: `/call-center/openapi/v1/businessDeptRelation/${parentRelationCode}`
  })
}
